﻿{% extends "base.html" %}
{% load i18n %}
{% block title %}{% trans 'subtitle' %}{% endblock %}

{% block head %}
<script type="text/javascript" src="/themes/plugins/highslide/highslide-with-html.packed.js"></script>
<script type="text/javascript" src="/themes/plugins/highslide/highslide.config.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="/themes/plugins/highslide/highslide.css" />

<script type="text/javascript">
if(!cm)
{
	var cm = { itemCount : 0,
		showItem : function( src,id )
		{
		    var obj = hs.$(id);
		    if( obj )
		        obj.style.display = (obj.style.display == "none")?"":"none";
		    if( src )
		        src.className = (src.className == "expand")?"collapse":"expand";
		},
		autoTree : function( )
		{
		    var tree = hs.$("treelist");
		    var bar = hs.$("sidebar");
		    var treeW = tree.style.width;
		    var barW = bar.style.width;
		    if( !treeW )
		    {
		        treeW = "278px";
		        barW = "0px";
		    }
		    tree.style.width = barW;
		    bar.style.width = treeW;
		},
	}
};// end cm object

function makeTree()
{
    var treeSet = document.getElementsByName("treeitem");
    var strs = new Array();
    strs.push("<ul>");
    for( var i = 0; i < treeSet.length; i++ ){
        var oItem = treeSet[i];
        var title = oItem.innerText;
        if( typeof(title) == "undefined" )  //firefox
            title = oItem.textContent
        var s = "<li><a href=\"#" + oItem.id + "\">"+title+"</a></li>";
        strs.push(s);
    }
    strs.push("</ul>");
    var oParent = document.getElementById("treelist");
    oParent.innerHTML =  strs.join("");
}
</script>
{% endblock %}


{% block bodytag %}
onload = "makeTree()"
{% endblock %}


{% block content %}
    {% for MainItem in HotCtgs %}
    <div class="post">
        <h1><a class="title0" href="{{ MainItem.url }}" rel="bookmark">{% trans MainItem.title %}</a>
		<a class="expand" href="javascript:void(0);" onclick="cm.showItem(this,'post-{{ MainItem.id }}')"></a>
		<a class="feedrss" href="#"></a>
        </h1>
    
    	<div class="clearfix" id="post-{{ MainItem.id }}">
            {% for Item in MainItem.SubItems %}
	            <h2><a class="title" name="treeitem" id="item-{{forloop.parentloop.counter}}-{{forloop.counter}}" href="{{ Item.SourceUrl }}">{{ Item.Title }}</a>
	            <a href="userphoto?item={{ Item.LastCommend.user_id }}" class="highslide" onclick="return hs.expand(this,{captionId:'usr000'})"
	            title="最近刚推荐者" style="float:right; margin:0 10px 0">
	                <img src="/userphoto?item={{ Item.LastCommend.user_id }}"  alt="" style="width:20px;height:20px;" />
	            </a>
	            <div class="highslide-caption" id="usr000">
	                <a href="#">{{ Item.LastCommend.nickname }}</a>
	            </div>
	            <a href="userphoto?item={{ Item.FirstCommend.user_id }}" class="highslide" onclick="return hs.expand(this,{captionId:'usr001'})"
	            title="第一个推荐者" style="float:right; margin:0 5px 0">
	                <img src="/userphoto?item={{ Item.FirstCommend.user_id }"  alt="" style="width:20px;height:20px;" />
	            </a>
	             <div class="highslide-caption" id="usr001">
	                <a href="#">{{ Item.FirstCommend.nickname }}</a>
	            </div>
	            </h2>
	            <div class="info clearfix">
	            <span class="date">
	                {{ Item.Date }}
	            </span>
	            <span class="from">
	                <a href="#">From:{{ Item.SourceUrl|gethostnamefromurl }}</a>
	            </span>
	            <span class="comments">
	                <a href="#">{{ Item.CommendNumber }} comments</a>
	            </span>
	            <span class="addcomment">
	                <a href="#">{{ Item.CollectNumber }} 收藏</a>
	            </span>
	            <span class="addrecmnt">
	               <a href="#">{{ Item.CommendNumber }} 推荐</a>
	            </span>
	            </div>
	            <div class="content clearfix" style="display: block;">
				{{ Item.Summary }}
	            <p><a class="more-link" href="#" onclick="return hs.htmlExpand(this, { 
	            width: 500, headingText: '{{ Item.title }}', 
	            wrapperClassName: 'titlebar',maincontentId: 'mycontent'} )">
	            Read More...
	            </a>
	            <a class="labels" href="#">label:随笔</a>
	            <div class="highslide-maincontent" id="mycontent">
	 滚滚长江东逝水， 
	浪花淘尽英雄。 
	是非成败转头空。 
	青山依旧在， 
	几度夕阳红。 
	白发渔樵江渚上， 
	惯看秋月春风。 
	一壶浊酒喜相逢。 
	古今多少事， 
	都付笑谈中。
	        	</div>
	            </p>
	            </div>
            {% endfor %}
        </div>
     </div>
    {% endfor %}
{% endblock %}


{% block treelist %}
<div id="treebar" onclick="cm.autoTree()" title="Click Me"></div>
<div id="treelist">
</div>
{% endblock %}


{% block sidebar %}
<div id="tag_cloud" class="widget">
        <h3>Tag Cloud</h3>
        {% for Item in Tags %}
            <a href="/tag/{{Item.TagName|urlencode}}"><span style='font-size:{{ Item.SearchNumber|add:9 }}px;'>{{Item.TagName}}</span></a>
        {% endfor %}
</div>
<div class="widget">
    <h3>recent comments</h3>
    <ul>
    <li> aaaaaaa</li>
    <li> aaaaaaa</li>
    <li> aaaaaaa</li>
    <ul>
</div>
<div class="widget">
    <h3>最活跃用户</h3>
    <a href="images/defaultphoto.jpg" class="highslide" onclick="return hs.expand(this,{captionId:'usr000'})"
            title="name" style="margin:0 10px 0">
                <img src="images/defaultphoto.jpg"  alt="" style="width:20px;height:20px;" />
    </a>
    <h3>最新注册用户</h3>
    <a href="images/defaultphoto.jpg" class="highslide" onclick="return hs.expand(this,{captionId:'usr000'})"
            title="name" style="margin:0 10px 0">
                <img src="images/defaultphoto.jpg"  alt="" style="width:20px;height:20px;" />
    </a>
</div>
{% endblock %}
